﻿#region Regions

using System;
using System.Collections.Generic;

using FMWare.Core.Base;

#endregion

namespace FMWare.Core.Translations
{
	public class Continent : Item
	{
		#region Constructors

		public Continent()
		{
			AltContinentalityNames = new List<String>();
		}

		#endregion

		#region Public Properties

		public List<String> AltContinentalityNames { get; set; }
		public Byte AltContinentalityNamesCount { get; set; }

		public String ContinentalityName { get; set; }
		public String FederationName { get; set; }
		public Byte FederationNameGender { get; set; }
		public String Name { get; set; }
		public Byte NameGender { get; set; }
		public String ShortFederationName { get; set; }
		public Byte ShortFederationNameGender { get; set; }
		public String ThreeLetterName { get; set; }

		#endregion

		#region Internal Properties

		internal override string ExportData
		{
			get { return Global.CreateDelimitedString(UniqueId, Name, ThreeLetterName, ContinentalityName, FederationName, ShortFederationName); }
		}

		#endregion

		#region Internal Methods

		internal override void Read(BinaryReader reader)
		{
			UniqueId = reader.ReadInt32();
			Name = reader.ReadString();
			NameGender = reader.ReadByte();
			ThreeLetterName = reader.ReadString();
			ContinentalityName = reader.ReadString();
			FederationName = reader.ReadString();
			FederationNameGender = reader.ReadByte();
			ShortFederationName = reader.ReadString();
			ShortFederationNameGender = reader.ReadByte();
			AltContinentalityNamesCount = reader.ReadByte();
			for (int i = 0; i < AltContinentalityNamesCount; i++)
				AltContinentalityNames.Add(reader.ReadString());
		}

		internal override void Write(BinaryWriter writer)
		{
			writer.Write(UniqueId);
			writer.Write(Name);
			writer.Write(NameGender);
			writer.Write(ThreeLetterName);
			writer.Write(ContinentalityName);
			writer.Write(FederationName);
			writer.Write(FederationNameGender);
			writer.Write(ShortFederationName);
			writer.Write(ShortFederationNameGender);
			writer.Write(AltContinentalityNamesCount);
			for (int i = 0; i < AltContinentalityNamesCount; i++)
				writer.Write(AltContinentalityNames[i]);
		}

		#endregion
	}
}